package com.xt.bean;

import com.xt.GlobalConstant;

import java.io.Serializable;

/**
 * 平台响应实体
 * Created by XT on 2018/5/3.
 */
public class PlatformResult implements Serializable{

    // 响应业务状态
    private Integer status;

    // 响应消息
    private String msg;

    // 响应中的数据
    private Object data;

    public static PlatformResult build(Integer status, String msg, Object data) {
        return new PlatformResult(status, msg, data);
    }

    public static PlatformResult ok(Object data) {
        return new PlatformResult(data);
    }

    public static PlatformResult ok() {
        return new PlatformResult(null);
    }

    public PlatformResult() {

    }

    public static PlatformResult build(Integer status, String msg) {
        return new PlatformResult(status, msg, null);
    }

    public PlatformResult(Integer status, String msg, Object data) {
        this.status = status;
        this.msg = msg;
        this.data = data;
    }

    public PlatformResult(Object data) {
        this.status = GlobalConstant.CODE_OK;
        this.msg = "OK";
        this.data = data;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

}
